$(document).ready(function(){
	
	var week1 = 0;
	$(".week1").each(function(){
		week1 += eval($(this).html());
	});
	$("#weekly1Total").html("R "+ formatCurrency(week1.toFixed(2)));
	
	var week2 = 0;
	$(".week2").each(function(){
		week2 += eval($(this).html());
	});
	$("#weekly2Total").html("R "+ formatCurrency(week2.toFixed(2)));
	
	var week3 = 0;
	$(".week3").each(function(){
		week3 += eval($(this).html());
	});
	$("#weekly3Total").html("R "+ formatCurrency(week3.toFixed(2)));
	
	var week4 = 0;
	$(".week4").each(function(){
		week4 += eval($(this).html());
	});
	$("#weekly4Total").html("R "+ formatCurrency(week4.toFixed(2)));
	
	var week5 = 0;
	$(".week5").each(function(){
		week5 += eval($(this).html());
	});
	$("#weekly5Total").html("R "+ formatCurrency(week5.toFixed(2)));
	
	
	$weeklySpendArray = new Array();
	var count = -1;
	$(".weeklyBudget").each(function(){
		$weeklySpendArray[count++] = $(this).html();
	});
	
		
	count = -1;
	var weeklySpendTotal = 0;
	$(".weeklySpend").each(function(){
		var amount = $weeklySpendArray[count++];
		weeklySpendTotal += (amount/4.5);
		$(this).html(formatCurrency((amount/4.5).toFixed(2)));
	});
	
	$("#weeklySpendTotal").html("R "+ formatCurrency(weeklySpendTotal.toFixed(2)));
});